﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DAL;

/// <summary>
/// Summary description for BoPhanBO
/// </summary>
public class BoPhanBO : DTPReportDataContext
{
    public BoPhanBO()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public int BoPhanInsert(DTP_BOPHAN objBoPhan)
    {
        try
        {
            DTP_BOPHAN BPhan = new DTP_BOPHAN();
            BPhan = objBoPhan;
           return PRC_DTP_BOPHAN_INSERT(BPhan.TENBOPHAN, BPhan.GHICHU,BPhan.ACTIVE);
            
        }
        catch
        {
            return -1;
        }
    }

    public bool BoPhanUpdate(DTP_BOPHAN objBoPhan)
    {
        try
        {
            DTP_BOPHAN BPhan = new DTP_BOPHAN();
            BPhan = objBoPhan;
            int result = PRC_DTP_BOPHAN_UPDATE(BPhan.ID, BPhan.TENBOPHAN, BPhan.GHICHU, BPhan.ACTIVE);
            if (result == 1)
                return true;
            else
                return false;
        }
        catch
        {
            return false;
        }
    }

    public List<PRC_DTP_BOPHAN_GETLISTBYIDResult> BoPhanGetListByID(int ID)
    {
        try
        {
            List<PRC_DTP_BOPHAN_GETLISTBYIDResult> result = new List<PRC_DTP_BOPHAN_GETLISTBYIDResult>();
            result = PRC_DTP_BOPHAN_GETLISTBYID(ID).ToList();
            return result;
        }
        catch (Exception ex)
        {
            return null;
        }
    }
    public List<PRC_DTP_BOPHAN_SEARCHResult> BoPhanGet_Search(DTP_BOPHAN objBoPhan)
    {
        try
        {
            List<PRC_DTP_BOPHAN_SEARCHResult> result = new List<PRC_DTP_BOPHAN_SEARCHResult>();
            result = PRC_DTP_BOPHAN_SEARCH(objBoPhan.TENBOPHAN, objBoPhan.GHICHU, objBoPhan.ACTIVE).ToList();
            return result;
        }
        catch (Exception ex)
        {
            return null;
        }
    }

}